package pl.edu.mimuw.irs.rcp.controller.editor.input;

import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.IPersistableElement;

import pl.edu.mimuw.irs.core.model.design.IRSWorkflow;
import pl.edu.mimuw.irs.rcp.controller.editor.IRSWorkflowEditor;

/**
 * @author Jakub Rauch
 * Created on: 2009-05-27
 */
public class IRSWorkflowEditorInput implements IEditorInput {

	// *** Attributes

	private IRSWorkflow irsWorkflow;
	public IRSWorkflow getIrsWorkflow() {
		return irsWorkflow;
	}
	public void setIrsWorkflow(IRSWorkflow irsWorkflow) {
		this.irsWorkflow = irsWorkflow;
	}
	
	// *** Methods

	@Override
	public boolean exists() {
		return true;
	}

	@Override
	public ImageDescriptor getImageDescriptor() {
		// XXX Auto-generated method stub
		return null;
	}

	@Override
	public String getName() {
		// XXX Auto-generated method stub
		//return null;
		return "name...";
	}

	@Override
	public IPersistableElement getPersistable() {
		return null;
	}

	@Override
	public String getToolTipText() {
		// XXX Auto-generated method stub
		return "Tooltip...";
	}

	@SuppressWarnings("unchecked")
	@Override
	public Object getAdapter(Class adapter) {
		// XXX Auto-generated method stub
		return IRSWorkflowEditor.class;
	}

	@Override
	public boolean equals(Object obj) {
		if (super.equals(obj)) {
			return true;
		}
		if (obj instanceof IRSWorkflowEditorInput) {
			return irsWorkflow.equals(((IRSWorkflowEditorInput)obj).getIrsWorkflow());
		}
		return false;
	}
	
	@Override
	public int hashCode() {
		return irsWorkflow.hashCode();
	}
}
